<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>父组件向子组件传递数据</title>
</head>

<body>

<div id="app">
  <cpn :cMovies="movies" :cMessage="message"></cpn>
</div>

<template id="cpn">
  <div>
    <ul>
      <li v-for="(item,index) in cmovies" :key="index">{{item}}</li>
      <!--<li v-for="(item, index) in cmovies" :key="index">{{item}}</li>-->
    </ul>
    <h2>{{cmessage}}</h2>
  </div>
</template>

<script src="js/vue.min.js"></script>
<script>

  const cpn = {
    template:'#cpn',
    props: ['cmovies','cmessage'],//数组写法
    data() {
      return {

      }
    },
    methods: {

    }

  }
  const app = new Vue({
    el:"#app",
    data:{
      message:"你好",
      movies:["复仇联盟","钢铁侠","秋之回忆","养鱼大法"]
    },
    components:{
      cpn
    }
  })
</script>
</body>

</html>